﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TrainingWorkshop.IDAL;
using TrainingWorkshop.DAL_EF.Translator;
using System.Data;
using System.Threading;
namespace TrainingWorkshop.DAL_EF
{
  public   class CourseRepository_EF :ICourseRepository
    {

        public int UpdateCourse(Model.Course c)
        {
           Course courseEF= CourseTranslator.ModelCourseToEF(c);
           int flag = 0;
           using(var db=new projectbEntities())
           {
                   db.Courses.Attach(courseEF);
                   db.ObjectStateManager.ChangeObjectState(courseEF, EntityState.Modified);
                   Thread.Sleep(10000);
                   flag=db.SaveChanges(); 
           }
           return flag;
        }
    }
}
